import request from '@/config/axios'

export interface UnitVO {
  id: number
  name: string
  code: string
  status: number
  sort: number
  remark: string
}

// 查询计量单位分页
export const getUnitPage = async (params) => {
  return await request.get({ url: `/base/unit/page`, params })
}

// 查询计量单位详情
export const getUnit = async (id: number) => {
  return await request.get({ url: `/base/unit/get?id=` + id })
}

// 新增计量单位
export const createUnit = async (data: UnitVO) => {
  return await request.post({ url: `/base/unit/create`, data })
}

// 修改计量单位
export const updateUnit = async (data: UnitVO) => {
  return await request.put({ url: `/base/unit/update`, data })
}

// 删除计量单位
export const deleteUnit = async (id: number) => {
  return await request.delete({ url: `/base/unit/delete?id=` + id })
}

// 导出计量单位 Excel
export const exportUnit = async (params) => {
  return await request.download({ url: `/base/unit/export-excel`, params })
}